#include <stdio.h>
#include <string.h>

int strend(char *s, char *t)
{
    int slen = strlen(s);
    int tlen = strlen(t);

    if(slen < tlen) return 0;

    while (*(t + tlen--) == *(s + slen--))
    {
        if(tlen == 0)
            return 1;    
    }

    return 0;
}

int main()
{
    char *s1 = "helloworld";
    char *s2 = "hellochina";
    char *s3 = "hi";
    char *t = "world";

    printf("s1: %d\n", strend(s1, t));
    printf("s2: %d\n", strend(s2, t));
    printf("s3: %d\n", strend(s3, t));

    return 0;
}